inline void VSScene::AddCamera(VSCamera * pCamera)
{
	if(pCamera)
	{
		for (unsigned int i = 0 ; i < m_pCamera.GetNum() ;i++)
		{
			if (m_pCamera[i] == pCamera)
			{
				return ;
			}
		}
		m_pCamera.AddElement(pCamera);
	}
}
inline VSCamera * VSScene::GetCamera(unsigned int i)const
{
	if(i >= m_pCamera.GetNum())
		return NULL;
	return m_pCamera[i];
}
inline void VSScene::ClearCamera()
{
	m_pCamera.Clear();
}
inline void VSScene::DeleteCamera(unsigned int i)
{	
	if(i >= m_pCamera.GetNum())
		return ;
	m_pCamera.Erase(i);

}
inline void VSScene::DeleteCamera(VSCamera * pCamera)
{
	for (unsigned int i= 0 ; i <(unsigned int )m_pCamera.GetNum() ; i++)
	{
		if(pCamera == m_pCamera[i])
		{
			m_pCamera.Erase(i);
		}
	}
	VSSpatial * pSpatial = DynamicCast<VSSpatial>(pCamera->GetParent());
	if (pSpatial)
	{
		pSpatial->DeleteCamera(pCamera);
	}
}
inline unsigned int VSScene::GetCameraNum() const
{
	return m_pCamera.GetNum();
}

inline void VSScene::AddLight(VSLight * pLight)
{
	if(pLight)
	{
		for (unsigned int i = 0 ; i < m_pLight.GetNum() ;i++)
		{
			if (m_pLight[i] == pLight)
			{
				return ;
			}
		}
		m_pLight.AddElement(pLight);
	}
}
inline VSLight * VSScene::GetLight(unsigned int i)const
{
	if(i >= m_pLight.GetNum())
		return NULL;
	return m_pLight[i];
}
inline void VSScene::ClearLight()
{
	m_pLight.Clear();
}
inline void VSScene::DeleteLight(unsigned int i)
{	
	if(i >= m_pLight.GetNum())
		return ;
	m_pLight.Erase(i);

}
inline void VSScene::DeleteLight(VSLight * pLight)
{
	for (unsigned int i= 0 ; i <m_pLight.GetNum() ; i++)
	{
		if(pLight == m_pLight[i])
		{
			m_pLight.Erase(i);
			return ;
		}
	}
	VSSpatial * pSpatial = DynamicCast<VSSpatial>(pLight->GetParent());
	if (pSpatial)
	{
		pSpatial->DeleteLight(pLight);
	}
	
}
inline unsigned int VSScene::GetLightNum()const
{
	return m_pLight.GetNum();
}
inline VSLight * VSScene::GetAllLight(unsigned int i)const
{
	if (i >= m_pAllLight.GetNum())
	{
		return NULL;
	}
	return m_pAllLight[i];
}
inline unsigned int VSScene::GetAllLightNum()const
{
	return m_pAllLight.GetNum();
}
